package com.mianyang.zhangsan.common.util;

import java.time.LocalDate;

/**
 * @author jiangjr
 */
public class NameGenerator {
    private static final String SEPARATOR = "_";

    public static String currentDateAsName() {
        LocalDate now = LocalDate.now();
        int year = now.getYear();
        int month = now.getMonthValue() + 1;
        int day = now.getDayOfMonth();
        return year + SEPARATOR + month + SEPARATOR + day;
    }

    public static String currentTimeStampAsName() {
        long timeStamp = System.currentTimeMillis();
        return String.valueOf(timeStamp);
    }

    public static String currentDateAsName(String prefix) {
        return prefix + SEPARATOR + currentDateAsName();
    }
}
